package de.wellenblau.slideshow
{
	import flash.display.Bitmap;
	import flash.display.Sprite;

	public class AbstractSlideshow extends Sprite implements ISlideshow
	{
		
		protected var _images:Array = new Array();
		protected var _imageCounter:uint;
		protected var _config:XMLList;
		
		public function AbstractSlideshow()
		{
		}
		
		public function set tweenconfig(config:XMLList):void{
			//save xml config
			_config = config;
			//call the config function
			initConfig();
		}	

		public function addImage(image:Bitmap):void
		{
			trace('image added');
			
			//hide the image
			image.alpha = 0;
			
			//store the new image in the que
			_images.push(image);
			
			//loading complete -> call the complete function
			if(_images.length == _imageCounter) loadingComplete();
		}
		
		public function set maxImages(counter:uint):void
		{
			//store the max number of displayed images
			_imageCounter = counter;
		}
		
		//childrens shoud be overwritten
		protected function loadingComplete():void{
			//nothing to do
		}
		
		//childrens shoud be overwritten
		protected function initConfig():void{
			//nothing to do
		}
		
	}
}